home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
051-075
/
disk_062
/
hackiconii_source
/
copyicon.c
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
4KB
|
147 lines
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* |_o_o|\\ Copyright (c) 1987 The Software Distillery. All Rights Reserved *
* |. o.| || Written by Doug Walker *
* | . | || The Software Distillery *
* | o | || 235 Trillingham Lane *
* | . |// Cary, NC 27511 *
* ====== BBS:(919)-471-6436 *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "mydebug.h"
#include "exec/types.h"
#include "exec/memory.h"
#include "intuition/intuition.h"
#include "graphics/gfxbase.h"
#include "stdio.h"
#include "hackicon.h"
#define COPY_FROM 0
#define COPY_TO 1
#define COPY_DONE 2
extern struct Menu Titles[], CopyTitles[];
extern struct Screen *Screen;
extern struct Window *Window;
extern struct ViewPort *ViewPort;
extern struct iconfont *fonts[2];
extern int fontnum;
extern USHORT colormap[];
CopyIcon(repeat)
int repeat;
{
struct IntuiMessage *imsg;
ULONG Class;
USHORT Code;
USHORT icondata[ILENGTH];
int MouseX, MouseY;
int state, which, i;
struct Image *curimage, *nextimage;
NewPtr(Window, 1);
ClearMenuStrip(Window);
SetMenuStrip(Window, CopyTitles);
state = COPY_FROM;
while(state != COPY_DONE)
{
if(!(imsg = (struct IntuiMessage *)GetMsg(Window->UserPort)))
{
WaitPort(Window->UserPort);
continue;
}
Class = imsg->Class;
Code = imsg->Code;
MouseX = imsg->MouseX;
MouseY = imsg->MouseY;
ReplyMsg(imsg);
switch(Class)
{
case MOUSEBUTTONS:
BUG(5, ("main: case MOUSEBUTTONS\n"))
if(Code == SELECTDOWN)
which = WhichIcon(MouseX, MouseY);
else if(which >= 0 && fonts[fontnum] &&
which == WhichIcon(MouseX, MouseY))
{
if(state == COPY_FROM)
{
BUG(5, ("Copy FROM # %d\n", which))
movmem((char *)(fonts[fontnum]->idata+(which*ILENGTH)),
(char *)icondata,
ILENGTH*sizeof(USHORT));
state = COPY_TO;
NewPtr(Window, 0);
}
else
{
BUG(5, ("Copy TO # %d\n", which))
fonts[fontnum]->flags |= CHANGED;
if(fonts[fontnum]->firstchar > which)
fonts[fontnum]->firstchar = which;
if(fonts[fontnum]->lastchar < which)
fonts[fontnum]->lastchar = which;
movmem((char *)icondata,
(char *)(fonts[fontnum]->idata+(which*ILENGTH)),
ILENGTH*sizeof(USHORT));
curimage = fonts[fontnum]->images + which;
nextimage = curimage->NextImage;
curimage->NextImage = (struct Image *)NULL;
DrawImage(Window->RPort, curimage, 0, 0);
curimage->NextImage = nextimage;
if(repeat)
{
state = COPY_FROM;
NewPtr(Window, 1);
}
else
state = COPY_DONE;
}
}
break;
case MENUPICK:
BUG(5, ("Copy: case MENUPICK\n"))
if(Code == MENUNULL) break;
BUG(8, ("Copy: menunum = %d\n", MENUNUM(Code)))
if((i = MENUNUM(Code)) > 0)
{
AboutHackicon();
break;
}
BUG(8, ("Copy: itemnum = %d\n", ITEMNUM(Code)))
i = ITEMNUM(Code);
switch(i)
{
case MC_ALTFONT:
SetFont();
break;
case MC_CANCEL:
state = COPY_DONE;
break;
default:
break;
}
break;
default:
break;
}
}
ClearPointer(Window);
ClearMenuStrip(Window);
SetMenuStrip(Window, Titles);
return(0);
}